#include<stdio.h>
int total,arr[1000000];
int process(long n){
    int i;
    total=0;
    while(n>1){
        i=9;
        while(n%i!=0 && i>1)i--;
        if(i==1)return 0;
        arr[++total]=i;
        n/=i;
    }
    return 1;
}
int main(){
    long n;
    scanf("%ld",&n);
    if(process(n))
        for(;total>=1;total--)
            printf("%d",arr[total]);
    else printf("-1");
    return 0;
}
